<include file="Public/head" />

<body>
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 餐桌分类 </strong></div>
    <div class="padding border-bottom">
      <a class="button border-main icon-plus-square-o" href="{:U('Tablecate/addTable')}"> {:L("tianjia")}</a>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="10%">{:L("canzhuoleixing")}</th>
        <th width="20%">{:L("kezuorenshu")}</th>
        <th width="10%">{:L("caozuo")}</th>
      </tr>
      <foreach name="list" item="v">
        <tr class="o{$v['table_cate_id']}">
          <td>{$v['table_cate_name']}</td>
          <td>{$v['sit_people']}</td>
          <td>
            <div class="button-group">
              <a class="button border-main" href="{:U('Tablecate/edit',array('id'=>$v['table_cate_id']))}"><span class="icon-edit"></span> {:L("bianji")}</a>
              <a class="button border-red" href="javascript:void(0)" onclick="return del({$v['table_cate_id']})"><span class="icon-trash-o"></span> {:L("shanchu")}</a>
            </div>
          </td>
        </tr>
      </foreach>
    </table>
  </div>
  <script type="text/javascript">
    function del(id){
      if(confirm("{:L('shanchuxiaoxi')}")){
        var url = "{:U('Tablecate/delete')}";
        $.getJSON(url,{id:id},function (data){
          if(data.result == 'tp1'){$(".o"+id).remove();}
          else if(data.result == 'break'){alert('ERROR.');}
        })
      }
    }
  </script>
</body>

</html>